package com.baturu.vin.hyundai.dal.dao;

import com.baturu.vin.hyundai.dto.HyundaiKiaPartsMappingDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface SimpleDAO {

    @Select("select id from `tmp_vin_cache_result` where `analyserName` = 'hyundaiKia'")
    List<Integer> queryResultIds();

    @Select({"<script>",
            "select vinCode, cacheData from `tmp_vin_cache_result` ",
            "where `id` IN ",
            "<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>",
            "</script>"})
    List<Map<String, String>> queryResultById(@Param("ids") List<Integer> ids);

    @Select({"<script>SELECT image_Code,btr_parts_name FROM hyundaikia_parts_mapping_v2",
            "WHERE btr_parts_name = #{name} limit 1",
            "</script>"})
    HyundaiKiaPartsMappingDTO queryHyundaiPartsName(@Param("name") String btrPartsName );

    @Select({"SELECT btr_parts_name partsName FROM hyundaikia_parts_mapping_v2",
            "WHERE IMAGE_CODE = #{imageCode} limit 100"})
    List<HyundaiKiaPartsMappingDTO> queryHyundaiPartsNameByImageCode(@Param("imageCode") String imageCode);
}